- include: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=ask-stg:ask"

- name: make the box be real
  hosts: ask-stg:ask
  user: root
  gather_facts: True

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - base
  - rkhunter
  - denyhosts
  - nagios_client
  - hosts
  - fas_client
  - collectd/base
  - apache
  - ask
  - fedmsg/base
  - rsyncd
  - sudo
  - { role: openvpn/client,
      when: env != "staging" }

  tasks:
  - include: "{{ tasks }}/yumrepos.yml"
  - include: "{{ tasks }}/2fa_client.yml"
  - include: "{{ tasks }}/motd.yml"
  - include: "{{ tasks }}/mod_wsgi.yml"

  handlers:
  - include: "{{ handlers }}/restart_services.yml"

- name: set up gluster on stg
  hosts: ask-stg
  user: root
  gather_facts: True

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - role: gluster/server
    name: gluster
    username: "{{ ask_gluster_username }}"
    password: "{{ ask_gluster_password }}"
    owner: root
    group: root
    datadir: /srv/glusterfs/ask-stg

  - role: gluster/client
    name: gluster
    servers:
    - ask01.stg.phx2.fedoraproject.org
    username: "{{ ask_gluster_username }}"
    password: "{{ ask_gluster_password }}"
    owner: apache
    group: root
    mountdir: /srv/askbot-uploaded

- name: set up gluster on prod
  hosts: ask
  user: root
  gather_facts: True

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - role: gluster/server
    name: gluster
    username: "{{ ask_gluster_username }}"
    password: "{{ ask_gluster_password }}"
    owner: root
    group: root
    datadir: /srv/glusterfs/ask

  - role: gluster/client
    name: gluster
    servers:
    - ask01.phx2.fedoraproject.org
    - ask02.phx2.fedoraproject.org
    username: "{{ ask_gluster_username }}"
    password: "{{ ask_gluster_password }}"
    owner: apache
    group: root
    mountdir: /srv/askbot-uploaded
